#include <REGX52.H>
#include "Key.h"
#include "Delay.h"
#include <INTRINS.H>
#include "Timer0.h"
unsigned int KeyNum=0;
unsigned int KeyMode=0;
void main(){
	P2=0xFE;
	Timer0Init();
	while(1){
		KeyNum=Key();
	if(KeyNum){
		if(KeyNum==1){
			KeyMode++;
		if(KeyMode>=2)
				KeyMode=0;

	}
}
	}
}

  unsigned int Count=0;
	void Timer0_Rutine() interrupt 1
	{  	
		TL0 = 0x66;		
	TH0 = 0xFC;
		Count++;
	if(Count>=500){
		Count=0;
	  if(KeyMode==0){
			P2=_crol_(P2,1);
	}
		if(KeyMode==1){
			P2=_cror_(P2,1);
	}
}
}